laravel resource set status code

38

php artisan make:controller PhotoController --resource --model=Photo
use App\User;
use App\Http\Resources\User as UserResource;

Route::get('/user', function () {
    return (new UserResource(User::find(1)))
               ->response()
               ->setStatusCode(200);
});

Comments

Submit
0 Comments